package edu.neu.cs6515.board.rules;

import edu.neu.cs6515.board.HexagonBoard;
import edu.neu.cs6515.xml.Placement;

/**
 * Parent for all classes that implement various game specific rules
 */
public abstract class Rule {

    protected final HexagonBoard board;

    /**
     * Init class with board obj
     * 
     * @param board
     *            the board to be used for validation
     */
    public Rule(final HexagonBoard board) {
        this.board = board;
    }

    /**
     * Validate the placement of the two given hexagons (a tile)
     * 
     * @param p
     *            Placement to be validated
     * 
     * @return true if the rule check was successful
     */
    public abstract boolean validate(Placement p);

    /**
     * Explantion why a rule was broken
     * 
     * @return explanation string
     */
    public abstract String getReason();
}
